
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
@session_start();
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/style.css" type="text/css" rel="stylesheet"/>
        <link href="css/change.css" type="text/css" rel="stylesheet"/>
        <link href="css/donhang.css" type="text/css" rel="stylesheet"/>
        <script src="jquery-1.11.0.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8" src="jquery/jquery-1.3.2.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="jquery/jquery.validate.js"></script>
        <script type="text/javascript" charset="utf-8" src="jquery/header.js"></script>
        <script type="text/javascript" charset="utf-8" src="jquery/slide-show.js"></script>
        <link rel="stylesheet" href="jquery-ui-1.10.4/jquery-ui-1.10.4/themes/base/jquery.ui.all.css">
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/jquery-1.10.2.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.core.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.widget.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.datepicker.js"></script>
        <script src="jquery-ui-1.10.4/jquery-ui-1.10.4/ui/jquery.ui.tabs.js"></script>
        <link rel="stylesheet" href="jquery-ui-1.10.4/jquery-ui-1.10.4/demos/demos.css">
        <script>
            $j = jQuery.noConflict();
            $j(function() {
                $j( "#datepicker" ).datepicker({
                    changeMonth: true,
                    changeYear: true
                });
            });
            $j(function() {
                $j( "#tabs" ).tabs();
            });
        </script>
        <script type="text/javascript">
            $(document).ready(function()    {
                $('#frmchange').validate();
                $('#information').validate();
            });

        </script>
        <title></title>
    </head>
    <body>
        <div id="wrapper">
            <?php include 'template/header.php' ?>
            <div id="main">
                <div id="tabs">
                    <ul>
                        <li><a href="#tabs-1">Thông tin khách hàng</a></li>
                        <li><a href="#tabs-2">Lịch sử mua hàng</a></li>
                    </ul>
                    <div id="tabs-1">
                        <div id="top">
                            <div id="change_pass">
                                <?php
//                        if(isset($_POST['pass'])){
                                if (isset($_SESSION['cus'])) {
                                    include 'Connect_db.php';
                                    $id = $_SESSION['cus']['cus_id'];
                                    $customer = getCustomerbyId($id);
                                    ?>

                                    <legend style="padding-left: 60px; margin-left: 10px;">Đổi mật khẩu</legend>
                                    <form action="process-change2.php" method="post" id="frmchange" >

                                        <label><strong>Mật khẩu cũ:<span>(*)</span></strong></label><br>
                                        <input  name="pass_old"   type="password" class="required" value="<?php echo $customer['cus_pass'] ?>"><br>
                                        <label><strong>Mật khẩu mới:<span>(*)</span></strong></label><br>
                                        <input  name="pass_new"  type="password" class="required" minlength="6"><br>           
                                        <label><strong>Xác nhận mật khẩu:<span>(*)</span></strong></label><br>
                                        <input  name="pass_confirm" type="password" class="required" minlength="6"><br> 										
                                        <input value="Cập Nhật" name="pass" type="submit"><br>
                                    </form>
                                    <!----END #pass-->

                                    <div id="change-info">
                                        <legend style="padding-left: 40px; margin-left: 10px;">Thông tin cá nhân</legend>
                                        <form action="process-change-imformation.php" method="post" name="information" id="information">                         
                                            <label><strong>Họ tên:<span>(*)</span></strong></label><br>
                                            <input  name="txtName"  type="text" class="required" value="<?php echo $customer['cus_name']; ?>"><br>
                                            <label><strong>Ngày sinh:<span>(*)</span></strong></label><br>
                                            <input type="text" name="dateSend" id="datepicker" class="required" value="<?php echo $customer['cus_DateBirth']; ?>"><br>
                                            <label><strong>Giới tính:<span>(*)</span></strong></label><br>
                                            <select class="Gender" name="gender" >
                                                <option value="">Chọn</option>
                                                <option value="nam">Nam</option>
                                                <option value="nữ">Nữ</option>
                                            </select><br>
                                            <label><strong>Email:<span>(*)</span></strong></label><br>
                                            <input  name="txtEmail"  type="text" class="required email" value="<?php echo $customer['cus_email'] ?>"><br>
                                            <label><strong>Điện thoại:<span>(*)</span></strong></label><br>
                                            <input  name="txtPhone"  type="text" class="required" minlength="9" value="<?php echo $customer['cus_phone'] ?>"><br>
                                            <label><strong>Địa chỉ:<span>(*)</span></strong></label>
                                            <input type="text" size="50" name="address" id="address" class="required" value="<?php echo $customer['cus_address'] ?>"/>
                                            <label><strong>Thành phố:<span>(*)</span></strong></label>
                                            <select name="city" id="city">
                                                <?php
                                                $city = getCity();
                                                foreach ($city as $key => $value) {
                                                    ?>
                                                    <option value="<?php echo $value['city_name'] ?>"><?php echo $value['city_name'] ?></option>
                                                    <?php
                                                }
                                                ?>
                                            </select></br>
                                            <input value="Cập Nhật" name="information" type="submit">
                                        </form>

                                        <?php
                                    }
//                            }
                                    ?>

                                </div><!--END #box-login---->             

                            </div>
                        </div>              
                    </div>
                    <div id="tabs-2">
                        <div id="order" >
                            <h2 class="title">ĐƠN HÀNG</h2>     
                            <?php
                            if (isset($_SESSION['cus'])) {

                                $id = $_SESSION['cus']['cus_id'];
                                $number_order = getNumberorder($id);
                                if($number_order > 0){
                                $customer = getCustomerbyId($id);
                                ?>
                                <div id="imformation-cus">
                                    <div class="heading">
                                        <h2> Thông tin khách hàng</h2><br>
                                    </div>
                                    <div class="address-payment">
                                        <h3>Địa chỉ thanh toán</h3>
                                        <ul>
                                            <li>TÊN KHÁCH HÀNG:<strong><?php echo $customer['cus_name'] ?></strong></li>
                                            <li>EMAIL:<strong><?php echo $customer['cus_email'] ?></strong></li>
                                            <li>NGÀY SINH:<strong><?php echo $customer['cus_DateBirth'] ?></strong></li>
                                            <li>ĐỊA CHỈ:<strong><?php echo $customer['cus_address'] ?></strong></li>

                                        </ul>
                                    </div>
                                    <div class="address-delivery">
                                        <h3>Địa chỉ giao hàng</h3>
                                        <ul>
                                            <li>TÊN KHÁCH HÀNG:<strong><?php echo $customer['cus_name'] ?></strong></li>
                                            <li>EMAIL:<strong><?php echo $customer['cus_email'] ?></strong></li>
                                            <li>NGÀY SINH:<strong><?php echo $customer['cus_DateBirth'] ?></strong></li>
                                            <li>ĐỊA CHỈ:<strong><?php echo $customer['cus_address'] ?></strong></li>

                                        </ul>
                                    </div>
                                    <div class="imformation-contact">
                                        <h3>Thông tin liên hệ</h3>
                                        <ul>
                                            <li>TÊN KHÁCH HÀNG:<strong><?php echo $customer['cus_name'] ?></strong></li>
                                            <li>EMAIL:<strong><?php echo $customer['cus_email'] ?></strong></li>
                                            <li>SỐ ĐIÊN THOẠI:<strong><?php echo $customer['cus_phone'] ?></strong></li>
                                        </ul>
                                    </div><!---END #imformation-contact---> 
                                </div><!--END #imformation-cus-->
                                <div id="imformation-pro">
                                    <div class="heading">
                                        <h2> Thông tin đơn hàng</h2><br>
                                    </div>
                                    <table>

                                        <tr>
                                            <td>Mã đơn hàng</td>
                                            <td>Ngày đặt hàng</td>
                                            <td>Ngày nhận</td>
                                            <td>Nơi nhận</td>
                                            <td>Hình thức thanh toán</td>
                                            <td>Hình thức vận chuyển</td>
                                            <td>Số lượng</td>
                                            <td>Tổng tiền</td>
                                        </tr>
                                        <?php
                                        $order = getorder($id);
                                        foreach ($order as $value) {
                                            ?>
                                            <tr>
                                                <td><a href="ViewOrder.php?order_id=<?php echo $value['order_id'] ?>"><?php echo $value['order_id'] ?></a></td>
                                                <td><?php echo $value['order_date'] ?></td>
                                                <td><?php echo $value['order_dateSend'] ?></td>
                                                <td><?php echo $value['order_placeRv'] ?></td>
                                                <td><?php echo $value['order_MPay'] ?></td>
                                                <td><?php echo $value['order_tran'] ?></td>
                                                <td><?php echo $value['sl'] ?></td>
                                                <td><?php echo $value['total'] ?></td>
                                            </tr>
                                            <?php
                                        }
                                        ?>
                                    </table>
                                </div><!--END #imformation-pro-->
                                <?php
                                }else{
                                    ?>
                                     <h3>Bạn chưa có đơn hàng nào</h3>
                                     <?php
                                }
                            }
                            ?>
                        </div><!--END #order-->
                    </div>
                </div>
            </div>
            <?php include 'template/footer.php' ?>
        </div><!----END #wrapper--->
    </body>
</html>

